﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

/// Taken / Borrowed / Adapted from SpecUnit (Scott Bellware http://code.google.com/p/specunit-net/)
namespace NUnit.Framework
{
    /// <summary>
    /// Base implementation for a Context Specification
    /// </summary>
    /// <remarks>
    /// A Context Specification is simply another way of looking at tests.  
    /// Instead of testing "units", a test fixture contains executable specifications
    /// </remarks>
    public abstract class ContextSpecification
    {

        [TestFixtureSetUp]
        public void TestFixtureSetUp()
        {
            Context_BeforeAllSpecs();
        }

        [TestFixtureTearDown]
        public void TestFixtureTearDown()
        {
            CleanUpContext_AfterAllSpecs();
        }

        [SetUp]
        public virtual void SetUp()
        {
            Context();
            Because();
        }

        [TearDown]
        public void TearDown()
        {
            Because_After();
            CleanUpContext();
        }

        protected void Pending()
        {
            Assert.Ignore();
        }

        protected void Pending(string message)
        {
            Assert.Ignore(message);
        }

        protected virtual void Context() { }
        protected virtual void CleanUpContext() { }
        protected virtual void Context_BeforeAllSpecs() { }
        protected virtual void CleanUpContext_AfterAllSpecs() { }
        protected virtual void Because() { }
        protected virtual void Because_After() { }

        protected Exception exception;

    }
}
